package com.springstudy.mybatisplus.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author chenrongrong
 * @since 2020/3/6 15:15
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
//TableName注解设置表名
@TableName(value = "t_person")
public class Person {

    //TableFiled注解表示属性对应的数据库字段
    @TableField("id")
    private Long id;

    @TableField("name")
    private String name;

    @TableField("career_id")
    private Long careerId;

    //通过设置TableFiled的exist属性可以表示这个字段是否是数据库字段
    @TableField(exist = false)
    private Career career;

    @TableField(exist = false)
    private List<Lesson> lessons;

}
